/*********************************************************
          File Name:queue_test.c
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Fri 15 Apr 2016 11:34:02 AM CST
**********************************************************/

#include <stdio.h>
#include "queue.h"

int p(int x)
{
  printf("%d\n", x);
  return 0;
}

int main()
{
  Queue* queue = NewQueue(10);
  qNode* tmp = (qNode*)malloc(sizeof(qNode));
  qNode* tmp1 = (qNode*)malloc(sizeof(qNode));
  tmp->job = 309;
  tmp->cb = p;
  tmp->front = NULL;
  tmp->rear = NULL;
  tmp1->job = 310;
  tmp1->cb = p;
  tmp1->front = NULL;
  tmp1->rear = NULL;
  queue->push_back(queue->queue, tmp);
  queue->push_back(queue->queue, tmp1);
  qNode* front = queue->front(queue->queue);
  front->cb(front->job);
  queue->pop_front(queue->queue);
  qNode* front1 = queue->front(queue->queue);
  front1->cb(front1->job);
  queue->pop_front(queue->queue);
  DeleteQueue(queue);
}
